<?php

require_once "html/spHtml.php";
require_once "html/spHead.php";
require_once "html/spBody.php";

class spDocument extends spElement
{
	private $html;
	private $head;
	private $body;
		
	public function __construct()
	{
		parent::__construct();
	}
	
	public function createSkeleton()
	{
		$this->html = new spHtml;
		$this->head = new spHead;
		$this->body = new spBody;
		
		$this->html->addChild( $this->head );
		$this->html->addChild( $this->body );
		parent::addChild( $this->html );
	}
	
	public function getHead()
	{
		return $this->head;
	}
	
	public function getBody()
	{
		return $this->body;
	}
	
	public function getHtml()
	{
		return $this->html;
	}

	// $indent not used here
	public function render( $indent=0 )
	{
		// should add type of docuement and switch
	
		//echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>\n";
		
		// we love the simple html5 doctype :)
		echo "<!DOCTYPE HTML>";
		
		$this->html->render();
	}
}

?>